{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "class Person:\n",
    "    people_count = 0\n",
    "\n",
    "    def __init__(self, name, age):\n",
    "        self.name = name\n",
    "        self.age = age\n",
    "        Person.people_count += 1\n",
    "\n",
    "    @classmethod\n",
    "    def display_count(cls):\n",
    "        print(\"Total people:\", cls.people_count)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Total people: 0\n",
      "Total people: 1\n",
      "Total people: 2\n"
     ]
    }
   ],
   "source": [
    "Person.display_count()  # 输出: Total people: 0\n",
    "person1 = Person(\"Alice\", 25)\n",
    "Person.display_count()  # 输出: Total people: 1\n",
    "person2 = Person(\"Bob\", 30)\n",
    "Person.display_count()  # 输出: Total people: 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "class Calculator:\n",
    "    @staticmethod\n",
    "    def add(x, y):\n",
    "        return x + y\n",
    "\n",
    "    @staticmethod\n",
    "    def multiply(x, y):\n",
    "        return x * y"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.0"
  },
  "orig_nbformat": 4,
  "vscode": {
   "interpreter": {
    "hash": "c261aea317cc0286b3b3261fbba9abdec21eaa57589985bb7a274bf54d6cc0a7"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
